package com.service.impl;

import com.dao.Admins_AccountsDao;
import com.dao.impl.Admins_AccountsDaoImpl;
import com.pojo.Admins_Accounts;
import com.service.Admins_AccountsService;

import java.util.List;

public class Admins_AccountsServiceImpl implements Admins_AccountsService {
    public List<Admins_Accounts> getAllAdmins_Accounts(String query) {
        Admins_AccountsDao admins_accountsDao = new Admins_AccountsDaoImpl();
        return admins_accountsDao.getAllAdmins_Accounts(query);
    }
    public int Add(Admins_Accounts admins_accounts){
        Admins_AccountsDao admins_accountsDao = new Admins_AccountsDaoImpl();
        return admins_accountsDao.Add(admins_accounts);
    }
    public int Delete(int id){
        Admins_AccountsDao admins_accountsDao = new Admins_AccountsDaoImpl();
        return admins_accountsDao.Delete(id);
    }
    public int Update(Admins_Accounts admins_accounts){
        Admins_AccountsDao admins_accountsDao = new Admins_AccountsDaoImpl();
        return admins_accountsDao.Update(admins_accounts);
    }
    public List<Admins_Accounts> pages(int index,int size,String query){
        Admins_AccountsDao admins_accountsDao = new Admins_AccountsDaoImpl();
        return admins_accountsDao.pages(index,size,query);
    }
    public int count(String query){
        Admins_AccountsDao admins_accountsDao = new Admins_AccountsDaoImpl();
        return admins_accountsDao.count(query);
    }
    public Admins_Accounts GetById(int id){
        Admins_AccountsDao admins_accountsDao = new Admins_AccountsDaoImpl();
        return admins_accountsDao.GetById(id);
    }
    public boolean Login(String username,String password){
        Admins_AccountsDao admins_accountsDao = new Admins_AccountsDaoImpl();
        return admins_accountsDao.Login(username,password);
    }
    public int getUidByName(String username){
        Admins_AccountsDao admins_accountsDao = new Admins_AccountsDaoImpl();
        return admins_accountsDao.getUidByName(username);
    }
    public String getUnameByPhone(String phone){
        Admins_AccountsDao admins_accountsDao = new Admins_AccountsDaoImpl();
        return admins_accountsDao.getUnameByPhone(phone);
    }
    public boolean getRole(int uid){
        Admins_AccountsDao admins_accountsDao = new Admins_AccountsDaoImpl();
        if(admins_accountsDao.getRole(uid).equals("超级管理员")){
            return true;
        }
        return false;
    }
    public boolean CheckPhone(String phone){
        Admins_AccountsDao admins_accountsDao = new Admins_AccountsDaoImpl();
        return admins_accountsDao.CheckPhone(phone);
    }
    public boolean CheckUname(String username){
        Admins_AccountsDao admins_accountsDao = new Admins_AccountsDaoImpl();
        return admins_accountsDao.CheckUname(username);
    }
}
